#! /usr/bin/php5
<?

include dirname(__FILE__).'/../Framework/inc.JCAT0.3_Entrance.php' ;
JCAT_Package::ImportClass('JCAT_FSOTreeIterator',JCAT::PACKAGE_FS) ;
JCAT_Package::ImportClass('JCAT_FSO',JCAT::PACKAGE_FS) ;

$sDir = '/home/alee/Project/JeCat/JCAT0.2/trunk/demo' ;

if( !is_dir($sDir) )
	exit("{$sDir} is not exists .") ;

$aIterator = new JCAT_FSOTreeIterator($sDir,JCAT_FSOIterator::DIR|JCAT_FSOIterator::RETURN_FSO) ;
$aIterator->First() ;
$arrDirs = array() ;
while( !$aIterator->IsDone() )
{
	$aDir = $aIterator->Current() ;	

	if( $aDir->GetName()=='.svn' )
	{
		//echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n" ;
		$arrDirs[] = $aDir->GetPath() ;
	}
	
	$aIterator->Next() ;
}


foreach($arrDirs as $sDir)
{
	echo $sDir ;
	echo "\r\n" ;
	echo '['.( JCAT_FSO::DeleteDir($sDir,true)? 'Delete': 'Fail')."]\r\n" ;
}

sleep(60) ;

?>